import javax.swing.*;

import java.awt.*;
import java.util.*;


public class SearchHits extends JScrollPane{
	private Map map = new Map();
	private ArrayList<RestaurantObject> restObjectArray= new ArrayList<RestaurantObject>();
	
	
	
	// To group the restaurant objects
	private JScrollPane restObjectPane = new JScrollPane();
	JPanel restObjectPanel = new JPanel();
	
	
	public SearchHits(){
		
		JSplitPane splitePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, restObjectPane,map);
		addToList();
		populateRestObjectPane();
		this.setViewportView(splitePane);
	}
	
	public void addToList(){
		for(int i = 0; i < 5; i++){
			restObjectArray.add(new RestaurantObject());
		}
	}

	
	/** Place all the restaurants in the search result on a panel*/
	public void populateRestObjectPane(){
		restObjectPanel.setLayout(new GridLayout(restObjectArray.size(), 1, 15, 15));
		for(int i = 0; i < restObjectArray.size(); i++){
			restObjectPanel.add((RestaurantObject)restObjectArray.get(i));
		}
		
		restObjectPane.setViewportView(restObjectPanel);
		
	}
	

public static void main(String[] args) {
   JFrame frame = new JFrame("Tabbed Pane Sample");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   SearchHits restOwnerMenu = new SearchHits();
  

   frame.add(restOwnerMenu, BorderLayout.CENTER);
   frame.setSize(750, 750);
   frame.setVisible(true);
   
}
}
